<!DOCTYPE html>
<html>
<head>
    <title>用户信息表</title>
    <#include "/header.html">
    <script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.0.0.min.js"></script>
</head>
<body>
<style>
    th{
        text-align: center;
    }
    td{
        text-align: center;
    }

    .vitaltb {
        border:1px solid #aeb2b7;
        text-align: left;
    }

    .vitaltbleft {
        border:1px solid #aeb2b7;
        text-align: left;
        width: 150px;
    }

    #box{
        max-width: 100%;
        border: 1px solid #e6e6e6;
        cursor: pointer;
    }

    #box tr td{
        padding: 15px 2px;
        max-width: 800px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }

    #box tr:nth-child(2n){
        background: #ECF0F5;
    }

    #box tr:nth-child(2n-1):hover{
        background: #ECF0F5;
    }

    #remarksContent{
        width: 100%;
        max-width: 100%;
        border: 1px solid #e6e6e6;
    }

    ul.nav-pills {
        margin-top: 5px;
    }

    ul.nav-pills>li {
        cursor: pointer;
    }

    .nav-box{
        display: none;
        padding-top: 8px;
    }
</style>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div style="float: left">
                <input style="width: 120px" type="text" class="form-control" v-model="q.user_id" @keyup.enter="query" placeholder="用户ID">
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <input style="width: 120px" type="text" class="form-control" v-model="q.nick_name" @keyup.enter="query" placeholder="用户名称">
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <input style="width: 120px" type="text" class="form-control" v-model="q.referer" @keyup.enter="query" placeholder="推荐人ID">
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <select style="height: 34px;" id="selectUserGzhList" v-model="q.gzhCode">

                </select>
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <select style="height: 34px;" id="blockStateList" v-model="q.blockState">
                    <option value="" >全部</option>
                    <option value="0">未拉黑</option>
                    <option value="1">已拉黑</option>
                </select>
            </div>
            <p style="float: left">&nbsp;</p>
            <!--<div style="float: left">
                <input style="width: 100px" class="form-control" list="brandName" placeholder="品牌" id="brandNames">
                <datalist id="brandName" style="line-height: 10px">

                </datalist>
            </div>-->
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <input style="width: 100px" class="form-control" list="queryAllArticleTypeNames" placeholder="行业" id="articleTypeName">
                <datalist id="queryAllArticleTypeNames" style="line-height: 10px">

                </datalist>
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <select style="height: 34px;" id="concernStatusList" v-model="q.concernStatus">
                    <option value="" >全部</option>
                    <option value="0">未关注</option>
                    <option value="1">已关注</option>
                </select>
            </div>
            <p style="float: left">&nbsp;</p>


            <a class="btn btn-default" @click="query">查询</a>
            <!--<a class="btn btn-default" @click="cancelUser" style="background-color: #8D8D8D;color: white">取关用户</a>-->
            <#if shiro.hasPermission("sys:buserinfo:update")>
            <a class="btn btn-primary" @click="userAdd"><i class="fa fa-plus"></i>&nbsp;新增用户</a>
            </#if>
            <#if shiro.hasPermission("sys:buserinfo:givevip")>
                <a class="btn btn-default" @click="updateCensus">更新统计数</a>
            </#if>



            <!--
            <#if shiro.hasPermission("sys:buserinfo:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
            <#if shiro.hasPermission("sys:buserinfo:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("sys:buserinfo:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>
            -->
        </div>
        <div style="height: 44px">
            <div style="float: left">
                <input style="width: 120px" type="text" class="form-control" v-model="q.user_name" @keyup.enter="query" placeholder="微信昵称" disabled />
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <select style="height: 34px;" id="vipStatusList" v-model="q.vipStatus">
                    <option value="" >全部</option>
                    <option value="1">会员</option>
                    <option value="0">非会员</option>
                </select>
            </div>
            <p style="float: left">&nbsp;</p>
            <div style="float: left">
                <span>关注时间</span>
                <input type="date" style="height: 34px;" v-model="q.beginConcernDate" placeholder="开始关注日期" /> -
                <input type="date" style="height: 34px;" v-model="q.endConcernDate" placeholder="结束关注日期" />
            </div>
            <p style="float: left">&nbsp;</p>
            <a class="btn btn-default" style="width: 105px" @click="resetCondition">清空条件</a>
        </div>

        <div style="float: left;width: 100%;">
            <table style="width: 100%;border:1px solid #aeb2b7;">
                <tr>
                    <td class="vitaltbleft">今日关注数/用户数:</td><td class="vitaltb" id="jtgzCount"></td>
                    <td class="vitaltbleft">今日取关数/用户数:</td><td class="vitaltb" id="jtqgCount"></td>
                    <td class="vitaltbleft">24小时活跃:</td><td class="vitaltb" id="d1hyCount"></td>
                    <td class="vitaltbleft">72小时活跃:</td><td class="vitaltb" id="d3hyCount"></td>
                </tr>
                <tr>
                    <td class="vitaltbleft">累积关注数:</td><td class="vitaltb" id="gzhljgzCount"></td>
                    <td class="vitaltbleft">昨天新关注数:</td><td class="vitaltb" id="gzhxzgzCount"></td>
                    <td class="vitaltbleft">昨天取关数:</td><td class="vitaltb" id="gzhqxgzCount"></td>
                    <td class="vitaltbleft">昨天净增:</td><td class="vitaltb" id="gzhjgzCount"></td>
                    <!--<td></td><td></td>-->
                </tr>
                <tr>
                    <td class="vitaltbleft">其他合计:</td><td class="vitaltb" id="gzhS0Count"></td>
                    <td class="vitaltbleft">公众号搜索:</td><td class="vitaltb" id="gzhS1Count"></td>
                    <td class="vitaltbleft">名片分享:</td><td class="vitaltb" id="gzhS17Count"></td>
                    <td class="vitaltbleft">扫描二维码:</td><td class="vitaltb" id="gzhS30Count"></td>
                    <!--<td></td><td></td>-->
                </tr>
            </table>
        </div>

        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>
    <div v-show="!addUser" class="panel panel-default" id="insert">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">用户昵称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="nick_name" name="nickName"  placeholder="用户昵称" onchange="nicknameClick(this)" />
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">头像</div>
                <div class="col-sm-10">
                    <!--<img width="200px" height="200px" id="img"/>-->
                    <input type="file"  class="form-control" id='uploadImg' onchange="inserttx(this)"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">邀请人ID</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="referer" onchange="refererClick(this)"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">设置为高级会员</div>
                <div class="col-sm-10">
                    <input name="Fruit" type="radio" value="1" />半年
                    <input name="Fruit" type="radio" value="2" />一年
                    <input name="Fruit" type="radio" value="3" />三年
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <button type="button" class="btn btn-primary" onclick="saveUser()" >确定</button>
            </div>
        </form>
    </div>
    <div v-show="!showList" class="panel panel-default">
        <!--<nav class="navbar navbar-default navbar-fixed-top">-->
        <nav class="navbar navbar-default" style="margin-bottom: -8px">
            <div class="container">
                <ul class="nav nav-pills">
                    <li role="presentation" class="active"><a href="###" id="tab_currentUser">个人信息</a></li>
                    <li role="presentation"><a href="###" id="tab_subUser">上下级关系</a></li>
                    <li role="presentation"><a href="###">上下级关系(列表)</a></li>
                    <li role="presentation"><a href="###" id="tab_userTeam">加入的团队</a></li>
                    <li role="presentation"><a href="###" id="tab_article">微站文章</a></li>
                    <li role="presentation"><a href="###" id="tab_shareArticle">分享文章</a></li>
                    <li role="presentation"><a href="###" id="tab_scanArticle">浏览过的文章</a></li>
                    <li role="presentation"><a href="###" id="tab_clock">打卡明细</a></li>
                    <li role="presentation"><a href="###" id="tab_brandPoster">品牌海报</a></li>
                    <li role="presentation"><a href="###" id="tab_otherFollowGzh">他还关注了</a></li>
                    <li role="presentation"><a href="###" id="tab_keyword">关键字回复</a></li>
                    <li role="presentation"><a href="###" id="tab_connectionApply">他添加了谁</a></li>
                    <li role="presentation"><a href="###" id="tab_buttonEvent">跟进用户点击行为</a></li>
                </ul>
            </div>
        </nav>
        <div class="nav-box" style="display: block">
            <div class="panel panel-default">
                <div class="panel-heading">{{title}}</div>
                <form class="form-horizontal">
                    <div class="form-group">
                        <div class="col-sm-2 control-label">用户ID</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="userId" v-model="bUserInfo.userId" placeholder="用户ID" readonly="readonly"/>
                        </div>
                    </div>
                    <div class="form-group">

                        <div class="col-sm-2 control-label">生成优惠链接</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="coupon_link" placeholder="优惠券链接" />
                            <input type="button" class="btn btn-primary" @click="createCouponLink" value="生成&复制"/>
                        </div>
                    </div>
                    <div class="form-group">

                        <div class="col-sm-2 control-label">用户昵称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.nickName" placeholder="用户昵称" readonly="readonly"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">用户签名</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.signature" placeholder="用户签名" readonly="readonly"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label">联系电话</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.telNum" placeholder="联系电话" readonly="readonly"/>
                        </div>
                    </div>

                    <!--<div class="form-group">
                        <div class="col-sm-2 control-label" style="color: red;">选择品牌</div>
                        <div class="col-sm-10">
                            <div id="selectBrandNameList">

                            </div>
                            <input class="form-control" list="allBrandNames" placeholder="品牌" id="selectBrandName">
                            <datalist id="allBrandNames" style="line-height: 10px">

                            </datalist>
                            <input type="button" onclick="addBrandName()" value="添加"/>
                        </div>
                    </div>-->

                    <div class="form-group">
                        <div class="col-sm-2 control-label" style="color: red;">选择分类</div>
                        <div class="col-sm-10">
                            <div id="selectArticleTypeNameList">

                            </div>
                            <input class="form-control" list="allArticleTypeNames" placeholder="分类" id="selectArticleTypeName">
                            <datalist id="allArticleTypeNames" style="line-height: 10px">

                            </datalist>
                            <input type="button" onclick="addArticleTypeName()" value="添加"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label">用户头像</div>
                        <div class="col-sm-10" style="position: relative">
                            <img v-bind:src="bUserInfo.avatarUrl" width="200px" height="200px"></img>
                            <img :src="headImgUrl" width="200px" height="200px" id="headImgUrl" alt="微信头像" style="position: absolute;left:210px"></img>
                            <button type="button" class="btn btn-primary" onclick="vm.getHeadImgUrl()" style="position: absolute;left:420px;top:80px">获取微信头像(大图)</button>
                            <p id="userSubscribeScene" style="position: absolute;left:420px;top:130px; width: 450px"></p>
                        </div>
                        <div class="col-sm-2 control-label">微信二维码</div>
                        <div class="col-sm-10" style="position: relative">
                            <img v-bind:src="bUserInfo.qrcodeUrl" width="200px" height="200px"></img>
                            <input type="file" accept="image/*" id='uploadQrcodeImg' onchange="insertQrcodeImg(this,'userQrCode')" multiple  style="position: absolute;left:210px;bottom:0px" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">邀请人</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.referer" placeholder="无" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">是否VIP认证</div>
                        <div class="col-sm-10">
                            <select class="form-control input-sm" id="vipStatus">

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">VIP到期时间</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.vipTime" placeholder="" readonly="readonly"/>
                        </div>
                    </div>

                    <#if shiro.hasPermission("sys:buserinfo:givevip")>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">VIP赠送类型</div>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="giveType" value="0" v-model="bUserInfo.giveType" /> 不赠送
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="giveType" value="1" v-model="bUserInfo.giveType"  /> 按到期时间赠送
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="giveType" value="2" v-model="bUserInfo.giveType" /> 按时长赠送
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">赠送VIP到期时间</div>
                        <div class="col-sm-10">
                            <input type="date" class="form-control" v-model="bUserInfo.giveVipDate" placeholder="" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">设置为高级会员</div>
                        <div class="col-sm-10">
                            <select class="form-control input-sm" id="vip">

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">通缉名单</div>
                        <div class="col-sm-10">
                            <input type="button" class="btn btn-warning" onclick="vm.addWantedUser()" value="加入通缉名单"/>
                            <input type="button" class="btn btn-danger" id="userShield" onclick="vm.shieldUserCopy()" value="屏蔽<换成我的>"/>
                        </div>
                    </div>
                    </#if>

                    <!--<div class="form-group">
                        <div class="col-sm-2 control-label">设置为高级会员</div>
                        <div class="col-sm-10">
                            <select class="form-control input-sm" id="vip">

                            </select>
                        </div>
                    </div>-->
                    <div class="form-group">
                        <div class="col-sm-2 control-label">关注时间</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.subscribeTime" placeholder="关注时间" readonly="readonly"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label">创建时间</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.createTime" placeholder="创建时间" readonly="readonly"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">最近活跃时间</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bUserInfo.modifyTime" placeholder="最近活跃时间" readonly="readonly"/>
                        </div>
                    </div>

                    <div class="form-group" style="display: none">

                        <div class="col-sm-2 control-label">备注</div>
                        <div class="col-sm-10">
                            <textarea name="Text1" cols="40" rows="5" v-model="bUserInfo.remarks"></textarea>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label" style="padding: 15px;">备注内容</div>
                        <div class="col-sm-10">
                            <textarea name="" cols="40" rows="5" maxlength="100" v-model="bUserInfoNot.remarksContent" id="remarksContent" placeholder="备注内容"></textarea>
                            <input type="button" class="btn btn-primary" style="position: absolute;top: 70px;left: 100%;" @click="savebUserInfoNot" value="保存备注" id="okbz"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label"></div>
                        <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定" id="ok"/>
                        <input type="button" class="btn btn-warning" @click="reload" value="返回" id="no"/>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-2 control-label">备注记录</div>
                        <div class="col-sm-10">
                            <table border="1" id="box">
                                <tr>
                                    <th>备注人</th>
                                    <th>备注时间</th>
                                    <th>备注内容</th>
                                </tr>
                                <tr v-for="(v,i) in obj">
                                    <td>{{obj[i].remarksUser}}</td>
                                    <td>{{v.remarksTime}}</td>
                                    <td>{{v.remarksContent}}</td>
                                </tr>
                            </table>
                            <input type="button" class="btn btn-default" @click="lookbUserInfoNot" value="刷新备注" id="okbzls"/>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="nav-box">
            上下级关系
        </div>
        <div class="nav-box">
            <table id="jqGridRelation"></table>
            用户下级(一级)
        </div>
        <div class="nav-box">
            <table id="jqGridTeam"></table>
            <div id="jqGridPagerTeam"></div>
            团队关系
        </div>
        <div class="nav-box">
            <table id="jqGridMicroStation"></table>
            <div id="jqGridPagerMicroStation"></div>
            微站文章
        </div>
        <div class="nav-box">
            <table id="jqGridShare"></table>
            <div id="jqGridPagerShare"></div>
            分享文章
        </div>
        <div class="nav-box">
            <table id="jqGridLookLog"></table>
            <div id="jqGridPagerLookLog"></div>
            浏览过的文章
        </div>
        <div class="nav-box">
            <table id="jqGridClockInfo"></table>
            <div id="jqGridPagerClockInfo"></div>
            打卡明细
        </div>
        <div class="nav-box">
            <table id="jqGridBrandPoster"></table>
            <div id="jqGridPagerBrandPoster"></div>
            品牌海报
        </div>
        <div class="nav-box">
            <table id="jqGridOtherFollowGzh"></table>
            <div id="jqGridPagerOtherFollowGzh"></div>
            他还关注了
        </div>
        <div class="nav-box">
            <table id="jqGridKeyword"></table>
            <div id="jqGridPagerKeyword"></div>
            关键字回复
        </div>
        <div class="nav-box">
            <table id="jqGridConnectionApply"></table>
            <div id="jqGridPagerConnectionApply"></div>
            他添加了谁
        </div>
        <div class="nav-box">
            <table id="jqGridButtonEvent"></table>
            <div id="jqGridPagerButtonEvent"></div>
            用户点击行为明细
        </div>
    </div>
</div>
<!-- layer.js 弹窗内容 -->
<div id="layerSubUserInfo" style="display: none">
    <table id="jqGridSubUserInfo"></table>
</div>
<!-- 修改用户品牌海报 -->
<div id="layerUserBrandPoster" style="display: none">
    <div id="brandPosterList" style="height: 390px">
        <!--<div style="width: 280px; float: left; margin: 10px">
            <input type="button" class="btn btn-danger" value="删除" style="float: right" />
            <img src="http://zktuistatic.oss-cn-shenzhen.aliyuncs.com/userLongTermQrCodeImg/8182/2021-09-04/0cfa9fd5-e842-4594-89f8-80af46c0be19.jpg" width="280px" height="280px" alt="" style="margin: 10px 0px" />
            <input type="file" accept="image/*" onchange="insertBrandPosterImg(this,'userLongTermQrCodeImg')" />
        </div>
        <div style="width: 280px; float: left; margin: 10px">
            <input type="button" class="btn btn-danger" value="删除" style="float: right" />
            <img src="http://zktuistatic.oss-cn-shenzhen.aliyuncs.com/userLongTermQrCodeImg/8182/2021-09-04/0cfa9fd5-e842-4594-89f8-80af46c0be19.jpg" width="280px" height="280px" alt="" style="margin: 10px 0px" />
            <input type="file" accept="image/*" onchange="insertBrandPosterImg(this,'userLongTermQrCodeImg')" />
        </div>
        <div style="width: 280px; float: left; margin: 10px">
            <input type="button" class="btn btn-danger" value="删除" style="float: right" />
            <img src="http://zktuistatic.oss-cn-shenzhen.aliyuncs.com/userLongTermQrCodeImg/8182/2021-09-04/0cfa9fd5-e842-4594-89f8-80af46c0be19.jpg" width="280px" height="280px" alt="" style="margin: 10px 0px" />
            <input type="file" accept="image/*" onchange="insertBrandPosterImg(this,'userLongTermQrCodeImg')" />
        </div>-->
    </div>
    <div style="text-align: center">
        <input type="button" class="btn btn-warning" style="width: 280px; margin: 10px" onclick="vm.closeLayerUserBrandPoster()" value="返回" />
        <input type="button" class="btn btn-primary" style="width: 280px; margin: 10px" onclick="vm.saveUserBrandPoster()" value="保存" />
    </div>
</div>
<script src="${request.contextPath}/statics/js/modules/sys/buserinfo.js?_${.now?long}"></script>
<script>
    function nicknameClick(e) {
        console.log(e.value);
        vm.bUserInfo.nickName=e.value;
    }
    function refererClick(e) {
        console.log(e.value);
        vm.bUserInfo.referer=e.value;
    }
    function  initInsert() {
        var url = location.search;
        var brandName=decodeURI(url);
        if (url != null && url != "") {
            var userId = url.split("=")[1];
            console.log(userId)
            console.log(brandName)
            if (isNumber(userId) == false) {
                brandName = brandName.split("=")[1];
                if (brandName.substring(brandName.length - 1, brandName.length) == ",") {
                    brandName = brandName.substring(0, brandName.length - 1);
                    console.log(brandName)
                    vm.q.userIds = brandName;
                } else {
                    vm.q.brandName = brandName;
                }
            } else if (url.split("=")[0] == '?brandId') {
                console.log(url.split("=")[1]);
                vm.q.brandId = url.split("=")[1];
            } else {
                vm.id = userId;
                $("#no").attr("style", "display:none;");
                update(userId);
            }
        }

        $.ajax({
            type: "POST",
            url: baseURL + 'sys/bbrandinfo/queryAll',
            contentType: "application/json",
            success: function(r){
                if(r.code==0){
                    for(var i=0;i<r.brandInfo.length;i++){
                        $("#allBrandNames").append(
                            "<option value=" + r.brandInfo[i].brandName +">"+"</option>");
                    }
                }
            }
        });

        $.ajax({
            type: "POST",
            url: baseURL + 'sys/barticletypeinfo/queryAll',
            contentType: "application/json",
            success: function(r){
                if(r.code==0){
                    //vm.bbrandinfo=r.brandInfo;
                    for(var i=0;i<r.barticletypeinfo.length;i++){
                        $("#queryAllArticleTypeNames").append(
                            "<option value=" + r.barticletypeinfo[i].articleTypeName +">"+"</option>");
                        $("#allArticleTypeNames").append(
                            "<option value=" + r.barticletypeinfo[i].articleTypeName +">"+"</option>");
                    }
                }
            }
        });

    }
    initInsert();


    /*add品牌*/
    function addBrandName() {
        var selectBrandName=$("#selectBrandName").val();

        if(selectBrandName.trim()==''){
            alert('请选择品牌');
            return false;
        }

        var len=$(".pBrandName").length;
        if(len==5){
            alert('最多可以添加5个品牌');
            return false;
        }

        if($(".pBrandName[value='"+selectBrandName+"']").length>0){
            alert('品牌已存在');
            return false;
        }

        var index=genID(6);//获取6位随机ID
        $("#selectBrandNameList").append(
            "<p class='pBrandName' id='pBrandName"+index+"' value='"+selectBrandName+"'>"+selectBrandName+"&nbsp;<a href='javascript:void(0);' onclick='delBrand("+index+")'>删除</a></p>");
        $("#selectBrandName").val("");
    }

    function delBrand(pId) {
        $("#pBrandName"+pId).remove();
    }

    /*add分类*/
    function addArticleTypeName() {
        console.log("add分类")
        var selectArticleTypeName=$("#selectArticleTypeName").val();

        if(selectArticleTypeName.trim()==''){
            alert('请选择分类');
            return false;
        }

        var len=$(".pArticleTypeName").length;
        if(len==5){
            alert('最多可以添加5个分类');
            return false;
        }

        if($(".pArticleTypeName[value='"+selectArticleTypeName+"']").length>0){
            alert('分类已存在');
            return false;
        }

        var index=genID(6);//获取6位随机ID
        $("#selectArticleTypeNameList").append(
            "<p class='pArticleTypeName' id='pArticleTypeName"+index+"' value='"+selectArticleTypeName+"'>"+selectArticleTypeName+"&nbsp;<a href='javascript:void(0);' onclick='delArticle("+index+")'>删除</a></p>");
        $("#selectArticleTypeName").val("");
    }

    function delArticle(pId) {
        $("#pArticleTypeName"+pId).remove();
    }

    function isNumber(val) {
        var regPos = /^\d+(\.\d+)?$/; //非负浮点数
        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
        if(regPos.test(val) || regNeg.test(val)) {
            return true;
        } else {
            return false;
        }
    }
    function upload(file, pathname = 'platformUserImg') {
        const client = new window.OSS({
            region: 'oss-cn-shenzhen', // hangzhou, shanghai, shenzhen
            accessKeyId: 'LTAIW4MTd90Wq32F',
            accessKeySecret: '7Bft5u5eOGRG47zXX8FCUNIzEOyVyP',
            bucket: 'vtarticle'
        });
        var date = new Date();
        var yeaer = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        var datePath =yeaer+"_"+month+"_"+day;
        var key = "";
        key=pathname+"/"+datePath+"/image"+String(parseInt(Math.random() * 10000000, 10));
        client.put(key, file).then(function () {
            return client.get(key);
        }).then(function(ret) {
            console.log(ret.res.requestUrls[0]);
            vm.bUserInfo.avatarUrl=ret.res.requestUrls[0];
            // $("#img").attr("src",ret.res.requestUrls[0]);
        }).catch(function(err) {

        });
    }
    function inserttx(e) {
        var files = e.files;
        var length = files.length;
        console.log("选择了" + length + "张图片");
        for (var i = 0; i < length; i++) {
            var fr = new FileReader();
            fr.onload = function (e) {
                console.log("回显了图片");
                console.log(this.result);
            }
            fr.readAsDataURL(files[i]); //读取文件
        }
        upload(files[0]);
    }

    /**
     * 上传二维码图片
     * @param e
     * @param pathname
     */
    function insertQrcodeImg(e,pathname) {
        var files = e.files;
        var length = files.length;
        console.log("选择了" + length + "张图片");
        for (var i = 0; i < length; i++) {
            var fr = new FileReader();
            fr.onload = function (e) {
                console.log("回显了图片");
                console.log(this.result);
            }
            fr.readAsDataURL(files[i]); //读取文件
        }
        uploadQrcodeImg(files[0],pathname);
    }

    function uploadQrcodeImg(file, pathname) {
        debugger
        var bucketName='zktuistatic';
        const client = new window.OSS({
            region: 'oss-cn-shenzhen', // hangzhou, shanghai, shenzhen
            accessKeyId: 'LTAI4Fh7PnYLw3uQvoUYiazS',
            accessKeySecret: 'cEw7e8QMz0h4XY4qmzCoTzhHITqyUU',
            bucket: bucketName
        });
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        if (month < 10) {
            month = "0" + month;
        }
        if (day < 10) {
            day = "0" + day;
        }
        var datePath =year+"-"+month+"-"+day;
        var key = "";
        var exName=getFileExtendingName(file.name);
        key=pathname+"/"+vm.bUserInfo.userId+"/"+datePath+"/"+guid()+exName;
        debugger
        client.put(key, file).then(function () {
            return client.get(key);
        }).then(function(ret) {
            // var rootUrl="https://zktuistatic.oss-cn-shenzhen.aliyuncs.com/";
            if(ret.res.status==200 && ret.res.statusCode==200) {
                /*if (vm.bUserInfo.qrcodeUrl != null && vm.bUserInfo.qrcodeUrl != '') {
                    var objName = vm.bUserInfo.qrcodeUrl.replace(rootUrl, "");
                    if (objName != null && objName != '') {
                        client.delete(objName);
                    }
                }*/
                vm.bUserInfo.qrcodeUrl = ret.res.requestUrls[0];
            }

        }).catch(function(err) {
            console.log(err);
        });
    }

    /**
     * 上传用户品牌海报图片
     * @param e
     * @param pathname
     */
    function insertBrandPosterImg(e,pathname) {
        // 获取上传文件对应的 img 对象
        let img = $(e).prev();

        var files = e.files;
        var length = files.length;
        console.log("选择了" + length + "张图片");
        for (var i = 0; i < length; i++) {
            var fr = new FileReader();
            fr.onload = function (e) {
                console.log("回显了图片");
                console.log(this.result);
            }
            fr.readAsDataURL(files[i]); //读取文件
        }
        uploadBrandPosterImg(files[0],pathname, img);
    }

    function uploadBrandPosterImg(file, pathname, img) {
        debugger
        var bucketName='zktuistatic';
        const client = new window.OSS({
            region: 'oss-cn-shenzhen', // hangzhou, shanghai, shenzhen
            accessKeyId: 'LTAI4Fh7PnYLw3uQvoUYiazS',
            accessKeySecret: 'cEw7e8QMz0h4XY4qmzCoTzhHITqyUU',
            bucket: bucketName
        });
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        if (month < 10) {
            month = "0" + month;
        }
        if (day < 10) {
            day = "0" + day;
        }
        var datePath =year+"-"+month+"-"+day;
        var key = "";
        var exName=getFileExtendingName(file.name);
        key=pathname+"/"+vm.bUserInfo.userId+"/"+datePath+"/"+guid()+exName;
        debugger
        client.put(key, file).then(function () {
            return client.get(key);
        }).then(function(ret) {
            // var rootUrl="https://zktuistatic.oss-cn-shenzhen.aliyuncs.com/";
            if(ret.res.status==200 && ret.res.statusCode==200) {
                /*if (vm.bUserInfo.qrcodeUrl != null && vm.bUserInfo.qrcodeUrl != '') {
                    var objName = vm.bUserInfo.qrcodeUrl.replace(rootUrl, "");
                    if (objName != null && objName != '') {
                        client.delete(objName);
                    }
                }*/

                // vm.bUserBrandInfo.brandPoster = ret.res.requestUrls[0];
                $(img).attr("src", ret.res.requestUrls[0]);

                // 如果当前的图片数量小于三张，则增加一个空的 img 元素
                let imgLength = $("#brandPosterList img").length;
                console.log("当前 img 个数为："+imgLength);
                if (imgLength < vm.brandPosterMaxCount) {
                    /*let total = vm.standardWidth * (imgLength + 1);
                    vm.brandPostLayero.css("width", total + "px");
                    vm.brandPostLayero.css("margin", "0px auto");// 水平居中显示*/
                    // 增加 div 的宽度
                    $("#brandPosterList").append(vm.createBrandImgObject(""));
                }
            }

        }).catch(function(err) {
            console.log(err);
        });
    }

    function getFileExtendingName (filename) {
        // 文件扩展名匹配正则
        var reg = /\.[^\.]+$/;
        var matches = reg.exec(filename);
        if (matches) {
            return matches[0];
        }
        return '';
    }

    function guid() {
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
            var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
            return v.toString(16);
        });
    }

    function saveUser() {
        vm.bUserInfo.vipRank=$("input[name='Fruit']:checked").val();
        console.log(vm.bUserInfo);

        $.ajax({
            type: "POST",
            url: baseURL + "sys/buserinfo/save",
            contentType: "application/json",
            data:JSON.stringify(vm.bUserInfo),
            success: function(r){
                if(r.code === 0){
                    alert("新增成功");
                }else{
                    alert(r.msg);
                }
            }
        });
    }
</script>

<script>
    $('ul.nav-pills>li').on('click', function () {
        $(this).addClass('active').siblings('.active').removeClass('active');
        // 获取索引
        let index = $(this).index('ul.nav-pills>li');
        console.info(index);
        // 隐藏掉内容
        $(".nav-box").fadeOut("slow");
        // 显示出当前的p标签
        $('.nav-box').eq(index).fadeIn("slow");

        console.info("${request.contextPath}");
        if (index == 1) {
            let name = "leader_member_relation";
            $.ajax({
                url: "../sys/" + name + ".html",// 加载html的地址
                global: false,
                type: "GET",
                dataType: "html",
                async: false,
                success: function (msg) {
                    $(".nav-box").eq(index).html(msg);

                }
            })
        }

        if (index == 2) {
            var uid = $("#userId").val();
            console.info(uid);
            let selector = "jqGridRelation";
            vm.getSubUserInfo(vm.bUserInfo.userId, selector, 1);
            vm.reloadRelation(vm.bUserInfo.userId, selector);
        }

        if (index == 3) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridTeam").jqGrid({
                    url: baseURL + 'sys/bteamrelation/list',
                    datatype: "json",
                    colModel: [
                        {label: '团队ID', name: 'teamId', index: 'team_id', align: "center", width: 80,
                            formatter: function (value, options, rowData) {
                                var teamId = rowData["teamId"];
                                return "<a href = bteamrelation.html?teamId=" + teamId + " target=\"_blank\">" + teamId + "</a>"
                            }},
                        {label: '团队名称', name: 'teamName', index: 'team_name', align: "center", width: 80},
                        {label: '团队人数', name: 'total', index: 'total', align: "center", width: 80},
                        // {label: '用户ID', name: 'userId', index: 'user_id', align: "center", width: 80},
                        // {label: '用户昵称', name: 'nickName', index: 'nick_name', align: "center", width: 80},
                        // {
                        //     label: '用户头像',
                        //     name: 'avatarUrl',
                        //     index: 'avatar_url',
                        //     width: 80,
                        //     align: "center",
                        //     sortable: false,
                        //     editable: false,
                        //     formatter: function (value, options, rowData) {
                        //         var url = "https://lktvtool.oss-cn-shenzhen.aliyuncs.com/icon/236A5FF0-52DE-4644-B66C-E9555C97693D.png";
                        //         if (value == null || value == "") {
                        //             return "<img src='" + url + "' width='60' />";
                        //         } else {
                        //             return "<img src='" + value + "' width='60' />";
                        //         }
                        //     }
                        // },
                        // {label: '公众号', name: 'gzhName', index: 'gzh_name', align: "center", width: 80},
                        {label: '邀请人', name: 'inviterId', index: 'inviter_id', align: "center", width: 80},
                        {label: '角色', name: 'teamRole', index: 'team_role', align: "center", width: 80,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                if (value == 0) {
                                    content = '普通成员';
                                } else if (value == 1) {
                                    content = '管理员';
                                } else if (value == 2) {
                                    content = '队长';
                                }
                                return content;
                            }
                        },
                        {label: '创建时间', name: 'createTime', index: 'create_time', align: "center", width: 80},
                    ],
                    viewrecords: true,
                    height: 520,
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerTeam",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridTeam").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadTeam(event) {
                $("#jqGridTeam").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId},
                    page: 1
                }).trigger("reloadGrid");
            };

            reloadTeam();
        }

        if (index == 4) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridMicroStation").jqGrid({
                    url: baseURL + 'sys/barticleinfo/listForUserId',
                    datatype: "json",
                    colModel: [
                        {label: 'id', name: 'id', index: 'id', align: "center", width: 60, key: true},
                        {
                            label: '文章名称', name: 'articleTitle', index: 'article_title', align: "center", width: 220,
                            formatter: function (value, options, rowData) {
                                var id = rowData['id'];
                                var del = rowData["articleStatus"];
                                var content = "";
                                if (del == 0) {
                                    content = "<p style='color: red' >" + value + "</p>";
                                } else if (del == 2) {
                                    content = "<p style='color: #8D8D8D'>" + value + "</p>";
                                } else {
                                    content = "<p style='color: #009688'>" + value + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '创建时间',
                            name: 'createTime',
                            dataType: "date",
                            sortable: true,
                            index: 'create_time',
                            align: "center",
                            width: 140
                        },
                        {label: '品牌/分类', name: 'articleTypeName', index: 'articleTypeName', align: "center", width: 80},
                        {
                            label: '分享',
                            name: 'articleShareCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_share_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热度',
                            name: 'articleHotScore',
                            dataType: "int",
                            sortable: true,
                            index: 'article_hot_score',
                            align: "center",
                            width: 50
                            // ,
                            // formatter:function(value,options,rowData){
                            // 	return value;
                            // }
                        },
                        {
                            label: '查看',
                            name: 'articleOutReadCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_out_read_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热门',
                            name: 'articleRecommendStatus',
                            sortable: false,
                            index: 'articleRecommendStatus',
                            align: "center",
                            width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                var id = rowData["id"];
                                if (value === 0 || value == "" || value == null) {
                                    content = "<p style='text-align: center'>" + "否" + "</p>"
                                } else if (value == 1) {
                                    content = "<p style='text-align: center'>" + "<strong style='color: red'>" + '是' + "</>" + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '来源', name: 'articleSource', index: 'article_source', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var thirdSource = rowData["thirdArticleSource"];
                                var source = rowData["articleSource"];
                                var content = "";
                                if (source == 1 && thirdSource == 1) {
                                    content = "好文";
                                } else if (source == 1 && thirdSource == 2) {
                                    content = "V名片"
                                } else if (source == 1 && thirdSource != null && thirdSource.length > 1) {
                                    content = thirdSource;
                                } else if (value === 1) {
                                    content = "平台";
                                } else if (value == 2) {
                                    content = "用户";
                                } else if (value == 3) {
                                    content = '用户'
                                } else if (value == 6) {
                                    content = '入库'
                                }
                                return content;
                            }
                        },
                        {
                            label: '类型', name: 'resourceType', index: 'resource_type', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                if (value === 1) {
                                    content = '文章';
                                } else if (value == 2) {
                                    content = '视频';
                                }
                                return content;
                            }
                        },
                        {
                            label: '状态', name: 'articleStatus', index: 'article_status', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                if (value === 1) {
                                    content = '正常';
                                } else if (value == 0) {
                                    content = "<p style='color: red'>" + '删除' + "</>"
                                } else if (value == 2) {
                                    content = '隐藏';
                                }
                                return content;
                            }
                        }
                    ],
                    viewrecords: true,
                    height: 520,
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerMicroStation",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridMicroStation").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });

                function reloadMicroStation(event) {
                    $("#jqGridMicroStation").jqGrid('setGridParam',{
                        postData: {'userId': vm.bUserInfo.userId},
                        page:1
                    }).trigger("reloadGrid");
                };

                reloadMicroStation();
            })
        }

        if (index == 5) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridShare").jqGrid({
                    url: baseURL + 'sys/barticleinfo/shareListForUserId',
                    datatype: "json",
                    colModel: [
                        {label: '文章Id', name: 'id', index: 'id', align: "center", width: 60, key: true},
                        {
                            label: '文章名称', name: 'articleTitle', index: 'article_title', align: "center", width: 220,
                            formatter: function (value, options, rowData) {
                                var id = rowData['id'];
                                var del = rowData["articleStatus"];
                                var content = "";
                                if (del == 0) {
                                    content = "<p style='color: red' >" + value + "</p>";
                                } else if (del == 2) {
                                    content = "<p style='color: #8D8D8D'>" + value + "</p>";
                                } else {
                                    content = "<p style='color: #009688'>" + value + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '创建时间',
                            name: 'createTime',
                            dataType: "date",
                            sortable: true,
                            index: 'create_time',
                            align: "center",
                            width: 140
                        },
                        {
                            label: '分享时间',
                            name: 'shareTime',
                            dataType: "date",
                            sortable: true,
                            index: 'share_time',
                            align: "center",
                            width: 140
                        },
                        {label: '品牌/分类', name: 'articleTypeName', index: 'articleTypeName', align: "center", width: 80},
                        {
                            label: '分享',
                            name: 'articleShareCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_share_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热度',
                            name: 'articleHotScore',
                            dataType: "int",
                            sortable: true,
                            index: 'article_hot_score',
                            align: "center",
                            width: 50
                            // ,
                            // formatter:function(value,options,rowData){
                            // 	return value;
                            // }
                        },
                        {
                            label: '查看',
                            name: 'articleOutReadCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_out_read_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热门',
                            name: 'articleRecommendStatus',
                            sortable: false,
                            index: 'articleRecommendStatus',
                            align: "center",
                            width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                var id = rowData["id"];
                                if (value === 0 || value == "" || value == null) {
                                    content = "<p style='text-align: center'>" + "否" + "</p>"
                                } else if (value == 1) {
                                    content = "<p style='text-align: center'>" + "<strong style='color: red'>" + '是' + "</>" + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '来源', name: 'articleSource', index: 'article_source', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var thirdSource = rowData["thirdArticleSource"];
                                var source = rowData["articleSource"];
                                var content = "";
                                if (source == 1 && thirdSource == 1) {
                                    content = "好文";
                                } else if (source == 1 && thirdSource == 2) {
                                    content = "V名片"
                                } else if (source == 1 && thirdSource != null && thirdSource.length > 1) {
                                    content = thirdSource;
                                } else if (value === 1) {
                                    content = "平台";
                                } else if (value == 2) {
                                    content = "用户";
                                } else if (value == 3) {
                                    content = '用户'
                                } else if (value == 6) {
                                    content = '入库'
                                }
                                return content;
                            }
                        },
                        {
                            label: '类型', name: 'resourceType', index: 'resource_type', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var articleTypeName = rowData["articleTypeName"];
                                var content = "";
                                if (value == 1) {
                                    content = '文章';
                                } else if (value == 2) {
                                    content = '视频';
                                }

                                if (articleTypeName == "" && value == 1) {
                                    content = '早安打卡';
                                } else if (articleTypeName == "" && value == 2) {
                                    content = '晚安打卡';
                                }
                                return content;
                            }
                        },
                        {
                            label: '状态', name: 'articleStatus', index: 'article_status', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                if (value === 1) {
                                    content = '正常';
                                } else if (value == 0) {
                                    content = "<p style='color: red'>" + '删除' + "</>"
                                } else if (value == 2) {
                                    content = '隐藏';
                                }
                                return content;
                            }
                        }
                    ],
                    viewrecords: true,
                    height: 520,
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerShare",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridShare").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });

                function reloadShare(event) {
                    $("#jqGridShare").jqGrid('setGridParam',{
                        postData: {'userId': vm.bUserInfo.userId},
                        page:1
                    }).trigger("reloadGrid");
                };

                reloadShare();
            })
        }

        if (index == 6) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridLookLog").jqGrid({
                    url: baseURL + 'sys/articlelookdetaillog/lookListForUserId',
                    datatype: "json",
                    colModel: [
                        {label: '文章Id', name: 'id', index: 'id', align: "center", width: 60, key: true},
                        {
                            label: '文章名称', name: 'articleTitle', index: 'article_title', align: "center", width: 220,
                            formatter: function (value, options, rowData) {
                                var id = rowData['id'];
                                var del = rowData["articleStatus"];
                                var content = "";
                                if (del == 0) {
                                    content = "<p style='color: red' >" + value + "</p>";
                                } else if (del == 2) {
                                    content = "<p style='color: #8D8D8D'>" + value + "</p>";
                                } else {
                                    content = "<p style='color: #009688'>" + value + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '创建时间',
                            name: 'createTime',
                            dataType: "date",
                            sortable: true,
                            index: 'create_time',
                            align: "center",
                            width: 140
                        },
                        {
                            label: '查看时间',
                            name: 'shareTime',
                            dataType: "date",
                            sortable: true,
                            index: 'share_time',
                            align: "center",
                            width: 140
                        },
                        {label: '品牌/分类', name: 'articleTypeName', index: 'articleTypeName', align: "center", width: 80},
                        {
                            label: '分享',
                            name: 'articleShareCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_share_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热度',
                            name: 'articleHotScore',
                            dataType: "int",
                            sortable: true,
                            index: 'article_hot_score',
                            align: "center",
                            width: 50
                            // ,
                            // formatter:function(value,options,rowData){
                            // 	return value;
                            // }
                        },
                        {
                            label: '查看',
                            name: 'articleOutReadCount',
                            dataType: "int",
                            sortable: true,
                            index: 'article_out_read_count',
                            align: "center",
                            width: 40
                        },
                        {
                            label: '热门',
                            name: 'articleRecommendStatus',
                            sortable: false,
                            index: 'articleRecommendStatus',
                            align: "center",
                            width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                var id = rowData["id"];
                                if (value === 0 || value == "" || value == null) {
                                    content = "<p style='text-align: center'>" + "否" + "</p>"
                                } else if (value == 1) {
                                    content = "<p style='text-align: center'>" + "<strong style='color: red'>" + '是' + "</>" + "</p>";
                                }
                                return content;
                            }
                        },
                        {
                            label: '来源', name: 'articleSource', index: 'article_source', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var thirdSource = rowData["thirdArticleSource"];
                                var source = rowData["articleSource"];
                                var content = "";
                                if (source == 1 && thirdSource == 1) {
                                    content = "好文";
                                } else if (source == 1 && thirdSource == 2) {
                                    content = "V名片"
                                } else if (source == 1 && thirdSource != null && thirdSource.length > 1) {
                                    content = thirdSource;
                                } else if (value === 1) {
                                    content = "平台";
                                } else if (value == 2) {
                                    content = "用户";
                                } else if (value == 3) {
                                    content = '用户'
                                } else if (value == 6) {
                                    content = '入库'
                                }
                                return content;
                            }
                        },
                        {
                            label: '类型', name: 'resourceType', index: 'resource_type', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var articleTypeName = rowData["articleTypeName"];
                                var content = "";
                                if (value == 1) {
                                    content = '文章';
                                } else if (value == 2) {
                                    content = '视频';
                                }

                                if (articleTypeName == "" && value == 1) {
                                    content = '早安打卡';
                                } else if (articleTypeName == "" && value == 2) {
                                    content = '晚安打卡';
                                }
                                return content;
                            }
                        },
                        {
                            label: '状态', name: 'articleStatus', index: 'article_status', align: "center", width: 40,
                            formatter: function (value, options, rowData) {
                                var content = "";
                                if (value === 1) {
                                    content = '正常';
                                } else if (value == 0) {
                                    content = "<p style='color: red'>" + '删除' + "</>"
                                } else if (value == 2) {
                                    content = '隐藏';
                                }
                                return content;
                            }
                        }
                    ],
                    viewrecords: true,
                    height: 520,
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerLookLog",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId, 'gzhCode': vm.bUserInfo.gzhCode},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridLookLog").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });

                function reloadLookLog(event) {
                    $("#jqGridLookLog").jqGrid('setGridParam',{
                        postData: {'userId': vm.bUserInfo.userId, 'gzhCode': vm.bUserInfo.gzhCode},
                        page:1
                    }).trigger("reloadGrid");
                };

                reloadLookLog();
            })
        }

        if (index == 7) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridClockInfo").jqGrid({
                    url: baseURL + 'sys/buserinfo/clockInfo',
                    datatype: "json",
                    colModel: [
                        /*{label: '用户编号', name: 'userId', index: 'userId', align: "center", width: 60},
                        {label: '用户名称', name: 'userName', index: 'userName', align: "center", width: 80},*/
                        {label: '打卡文章编号', name: 'clockArticleId', index: 'clockArticleId', align: "center", width: 60},
                        {label: '打卡文章名称', name: 'articleTitle', index: 'articleTitle', align: "center", width: 200},
                        { label: '打卡日期', name: 'createTime', index: 'createTime',align: "center", width:80 },
                        /*{ label: '修改日期', name: 'modifyTime', index: 'modifyTime',align: "center", width: 80 },*/
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerClockInfo",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridRelation").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadClockInfo(event) {
                $("#jqGridClockInfo").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId}
                }).trigger("reloadGrid");
            };

            reloadClockInfo();
        }

        if (index == 8) {
            /*$(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridBrandPoster").jqGrid({
                    url: baseURL + 'sys/buserbrandinfo/getUserBrand',
                    datatype: "json",
                    colModel: [
                        {label: 'id', name: 'id', index: 'id', align: "center", width: 60, key: true},
                        {label: '用户编号', name: 'userId', index: 'userId', align: "center", width: 60},
                        {label: '用户名称', name: 'createBy', index: 'createBy', align: "center", width: 100},
                        {label: '品牌编号', name: 'brandId', index: 'brand_id', align: "center", width: 60},
                        {label: '品牌名称', name: 'brandName', index: 'brand_name', align: "center", width: 100},
                        {label: '品牌(微站)选中状态', name: 'brandStatus', index: 'brand_status', align: "center", width: 70, formatter: function(value,options,rowData) {
                                if (value == 0) {
                                    return "未选中";
                                } else if (value == 1) {
                                    return "已选中"
                                }
                            }
                        },
                        /!*{label: '品牌状态', name: 'effectiveStatus', index: 'effective_status', align: "center", width: 60, formatter: function(value,options,rowData) {
                                if (value == 0) {
                                    return "已删除";
                                } else if (value == 1) {
                                    return "正常"
                                }
                            }
                        },*!/
                        { label: '创建日期', name: 'createTime', index: 'createTime',align: "center", width:80 },
                        { label: '修改日期', name: 'modifyTime', index: 'modifyTime',align: "center", width: 80 },
                        {label: '品牌海报', name: 'brandPoster', index: 'brand_poster', align: "center", width: 60, formatter: function(value,options,rowData) {
                                return "<img src='"+value+"' width='60px' height='60px' />";
                            }
                        },
                        { label: '操作', name: '', index: '',align: "center", width: 80, formatter: function(value,options,rowData) {
                                let id = rowData["id"];
                                return "<a class='btn btn-primary' onclick='vm.updateUserBrandPoster("+id+")'>修改海报</a>"
                            }
                        },
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerBrandPoster",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridRelation").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadBrandPoster(event) {
                $("#jqGridBrandPoster").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId}
                }).trigger("reloadGrid");
            };*/

            loadUserBrandPoster();
            reloadBrandPoster();
        }

        if (index == 9) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridOtherFollowGzh").jqGrid({
                    url: baseURL + 'sys/buserinfo/userOtherFollowGzh',
                    datatype: "json",
                    colModel: [
                        {label: '用户编号', name: 'userId', index: 'user_id', align: "center", width: 40},
                        {label: '用户昵称', name: 'nickName', index: 'nick_name', align: "center", width: 80},
                        {
                            label: '用户头像',
                            name: 'avatarUrl',
                            index: 'avatarUrl',
                            width: 60,
                            align: "center",
                            sortable: false,
                            editable: false,
                            formatter: function (value, options, rowData) {
                                var url = "https://lktvtool.oss-cn-shenzhen.aliyuncs.com/icon/236A5FF0-52DE-4644-B66C-E9555C97693D.png";
                                if (value == null || value == "") {
                                    return "<img src='" + url + "' width='60' height='60' />";
                                } else {
                                    return "<img src='" + value + "' width='60' height='60' />";
                                }
                            }
                        },
                        { label: '关注品牌', name: 'brandName', index: 'brandName',align: "center", width: 80 },
                        { label: '会员状态', name: 'vipStatus', index: 'vip_status',align: "center", width: 60 ,formatter:function(value,options,rowData){
                                if( value===1 ){
                                    return "<p style='color: #1AE61A'>" + '会员' + "</>";;
                                }else{
                                    return '非会员';
                                }
                            }
                        },
                        { label: '公众号关注状态', name: 'concernStatus', index: 'concern_status',align: "center", width: 80 ,formatter:function(value,options,rowData){
                                if( value===1 ){
                                    return "<p style='color: #0997F7'>" + '已关注' + "</p>";
                                }else{
                                    let unsubscribeTime = rowData["unsubscribeTime"];
                                    if(unsubscribeTime==null){
                                        return "<p style='color: #888888'>" + '未关注' + "</p>";
                                    }else {
                                        return "<p style='color: #FF0000'>" + '已取关'+"</p>" +unsubscribeTime ;
                                    }
                                }
                            }
                        },
                        { label: '公众号', name: 'gzhName', index: 'gzh_name',align: "center", width:60 },
                        { label: '关注时间', name: 'subscribeTime', index: 'subscribe_time',align: "center", width: 80 },
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerOtherFollowGzh",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridOtherFollowGzh").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadOtherFollowGzh(event) {
                $("#jqGridOtherFollowGzh").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId}
                }).trigger("reloadGrid");
            };

            reloadOtherFollowGzh();
        }

        if (index == 10) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridKeyword").jqGrid({
                    url: baseURL + 'sys/keywordlog/userKeyword',
                    datatype: "json",
                    colModel: [
                        {label: '关键字', name: 'keyword', index: 'keyword', align: "center", width: 80},
                        {label: '公众号', name: 'gzhName', index: 'gzh_name', align: "center", width: 80},
                        { label: '回复类型', name: 'bizmsgmenuid', index: 'bizmsgmenuid',align: "center", width: 80 ,formatter:function(value,options,rowData){
                                if( value == "" ){
                                    return "<p style='color: green'>输入回复</p>";
                                }else{
                                    return "点击回复";
                                }
                            }
                        },
                        { label: '回复时间', name: 'createTime', index: 'create_time',align: "center", width: 80 },
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerKeyword",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridKeyword").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadKeyword(event) {
                $("#jqGridKeyword").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId}
                }).trigger("reloadGrid");
            };

            reloadKeyword();
        }

        if (index == 11) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);
                $("#jqGridConnectionApply").jqGrid({
                    url: baseURL + 'sys/bconnectionapplyinfo/listByUserId',
                    datatype: "json",
                    colModel: [
                        {label: '用户ID', name: 'connectionToUserId', index: 'connection_to_user_id', align: "center", width: 80},
                        {label: '用户名称', name: 'connectionToUserName', index: 'connectionToUserName', align: "center", width: 80},
                        {label: '申请好友消息', name: 'connectionFromUserMsg', index: 'connection_from_user_msg', align: "center", width: 200},
                        {label: '申请状态', name: 'connectionIsPasses', index: 'connection_is_passes', align: "center", width: 80 ,formatter:function(value,options,rowData){
                                if( value == 0 ){
                                    return "<p style='color: red'>未通过</p>";
                                }else if (value == 1){
                                    return "已通过";
                                }
                            }
                        },
                        {label: '申请时间', name: 'applyTime', index: 'apply_time', align: "center", width: 100},
                        { label: '通过时间', name: 'passesTime', index: 'passes_time',align: "center", width: 100 },
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerConnectionApply",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridConnectionApply").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadConnectionApply(event) {
                $("#jqGridConnectionApply").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId}
                }).trigger("reloadGrid");
            };

            reloadConnectionApply();
        }

        if (index == 12) {
            $(function () {
                var uid = $("#userId").val();
                console.info(uid);

                // let eventCode = ['K0001', 'K0002', 'K0003', 'K0004', 'K0005', 'K0006', 'K0007', 'K0008', 'K0009', 'K0010', 'K0011'];

                $("#jqGridButtonEvent").jqGrid({
                    url: baseURL + 'sys/buttonevent/list',
                    datatype: "json",
                    colModel: [
                        { label: '事件名称', name: 'eventname', index: 'eventname', align: "center", width: 100 },
                        { label: '公众号 ', name: 'gzhName', index: 'gzhName', align: "center", width: 60 },
                        { label: '创建时间 ', name: 'createtime', index: 'createtime', align: "center", width: 100 },
                    ],
                    viewrecords: true,
                    height: "100%",
                    rowNum: 15,
                    rowList: [15, 30, 50],
                    rownumbers: true,
                    rownumWidth: 25,
                    autowidth: true,
                    multiselect: true,
                    pager: "#jqGridPagerButtonEvent",
                    jsonReader: {
                        root: "page.list",
                        page: "page.currPage",
                        total: "page.totalPage",
                        records: "page.totalCount"
                    },
                    prmNames: {
                        page: "page",
                        rows: "limit",
                        order: "order"
                    },
                    postData: {'userId': vm.bUserInfo.userId, 'gzhCode': vm.bUserInfo.gzhCode},
                    gridComplete: function () {
                        //隐藏grid底部滚动条
                        $("#jqGridButtonEvent").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
                    }
                });
            });
            function reloadButtonEvent(event) {
                $("#jqGridButtonEvent").jqGrid('setGridParam',{
                    postData: {'userId': vm.bUserInfo.userId, 'gzhCode': vm.bUserInfo.gzhCode}
                }).trigger("reloadGrid");
            };

            reloadButtonEvent();
        }
    });

    function loadUserBrandPoster() {
        var uid = $("#userId").val();
        console.info(uid);
        $("#jqGridBrandPoster").jqGrid({
            url: baseURL + 'sys/buserbrandinfo/getUserBrand',
            datatype: "json",
            colModel: [
                {label: 'id', name: 'id', index: 'id', align: "center", width: 60, key: true},
                {label: '用户编号', name: 'userId', index: 'userId', align: "center", width: 60},
                {label: '用户名称', name: 'createBy', index: 'createBy', align: "center", width: 100},
                {label: '品牌编号', name: 'brandId', index: 'brand_id', align: "center", width: 60},
                {label: '品牌名称', name: 'brandName', index: 'brand_name', align: "center", width: 100},
                {label: '品牌(微站)选中状态', name: 'brandStatus', index: 'brand_status', align: "center", width: 70, formatter: function(value,options,rowData) {
                        if (value == 0) {
                            return "未选中";
                        } else if (value == 1) {
                            return "已选中"
                        }
                    }
                },
                /*{label: '品牌状态', name: 'effectiveStatus', index: 'effective_status', align: "center", width: 60, formatter: function(value,options,rowData) {
                        if (value == 0) {
                            return "已删除";
                        } else if (value == 1) {
                            return "正常"
                        }
                    }
                },*/
                { label: '创建日期', name: 'createTime', index: 'createTime',align: "center", width:80 },
                { label: '修改日期', name: 'modifyTime', index: 'modifyTime',align: "center", width: 80 },
                {label: '品牌海报', name: 'brandPoster', index: 'brand_poster', align: "center", width: 120, formatter: function(value,options,rowData) {
                        let content = "";
                        if (value && value != '') {
                            let brandPosters = value.split(",");
                            for (let i = 0; i < brandPosters.length; i++) {
                                content += "<img src='"+brandPosters[i]+"' width='60px' height='60px' style='margin-right: 6px' />"
                            }
                        }
                        return content;
                    }
                },
                { label: '操作', name: '', index: '',align: "center", width: 80, formatter: function(value,options,rowData) {
                        let id = rowData["id"];
                        return "<a class='btn btn-primary' onclick='vm.updateUserBrandPoster("+id+")'>修改海报</a>"
                    }
                },
            ],
            viewrecords: true,
            height: "100%",
            rowNum: 15,
            rowList: [15, 30, 50],
            rownumbers: true,
            rownumWidth: 25,
            autowidth: true,
            multiselect: true,
            pager: "#jqGridPagerBrandPoster",
            jsonReader: {
                root: "page.list",
                page: "page.currPage",
                total: "page.totalPage",
                records: "page.totalCount"
            },
            prmNames: {
                page: "page",
                rows: "limit",
                order: "order"
            },
            postData: {'userId': vm.bUserInfo.userId},
            gridComplete: function () {
                //隐藏grid底部滚动条
                $("#jqGridRelation").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
            }
        });
    }
    function reloadBrandPoster(event) {
        $("#jqGridBrandPoster").jqGrid('setGridParam',{
            postData: {'userId': vm.bUserInfo.userId}
        }).trigger("reloadGrid");
    };
</script>
</body>
</html>
